<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Test content-visibility:hidden text is not selected</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
</head>
<body>
  <p style="content-visibility: hidden;">This is hidden text.</p>

  <script>
    promise_test(async t => {
      const range = document.createRange();
      range.selectNodeContents(document.body);
      const selection = window.getSelection();
      selection.addRange(range);

      const selectedText = selection.toString().trim();
      assert_equals(selectedText, '', 'Text with content-visibility: hidden should not be selected');
    }, 'Text with content-visibility: hidden is not selected');
  </script>
</body>
</html>
